
// const API_BASE_URL = 'https://wechat.tiancaifan.cn';
const API_BASE_URL = 'http://localhost:8083';
const request = (url, data) => { 
  let _url = API_BASE_URL  + url;
  return new Promise((resolve, reject) => {
    wx.request({
      url: _url,
      method: "get",
      data: data,
      header: {
        'Content-Type': 'application/x-www-form-urlencoded'
      },
      success(request) {
        resolve(request.data)
        
      },
      fail(error) {
        reject(error)
      }
    })
  });
}
module.exports ={
  login:(data)=>{
    return request('/login',data)
  },
  getSearch:(data) =>{
    return request('/search',data)
  },
  getbookInfo:(data)=>{
    return request('/getbookInfo',data)
  },
  getBookIndex:(data)=>{
    return request('/getbookindex',data)
  },
  getbookcontent:(data)=>{
    return request('/getbookcontent',data)
  },
  gethistory:(data)=>{
    return request('/gethistory',data)
  },
  getnewnotice:()=>{
    return request('/getnotice',null)
  },
  getbookshelf:(data)=>{
    return request('/getbookshelf',data)
  },
  deletebookshelf:(data)=>{
    return request('/deletebookshelf',data)
  },
  addbookshelf:data=>{
    return request('/addbookshelf',data)
  },
  updatauserreadHistory: data=>{
    return request('/updatauserreadhistory',data)
  },
  updateuserreadtimebyid:data=>{
    return request('/updateuserreadtimebyid',data)
  },
  getuser: data=>{
    return request('/getuser',data)
  },
  getrecbook:()=>{
    return request('/getrecbook')
  },
  gettotleuserreadhistory:(data)=>{
    return request('/gettotleuserreadhistory',data)
  }
}